<?php
/**
 * Set the content width based on the theme's design and stylesheet.
 */
if ( ! isset( $content_width ) )
	$content_width = 730;

	register_nav_menus( array(
		'primary' => __( 'Primary Navigation', 'ceyloan' ),
	) );
	function ceyloan_excerpt_length( $length ) {
	return 40;
	}
	add_filter( 'excerpt_length', 'ceyloan_excerpt_length' );
	function ceyloan_continue_reading_link() {
		return ' <a class="read-more" href="'. get_permalink() . '">' . __( 'Read more <span class="meta-nav">&rarr;</span>', 'ceyloan' ) . '</a>';
	}
	function ceyloan_auto_excerpt_more( $more ) {
		return ' &hellip;' . ceyloan_continue_reading_link();
	}
	add_filter( 'excerpt_more', 'ceyloan_auto_excerpt_more' );
	
function ceyloan_widgets_init() {
	// Area 1, located at the top of the sidebar.
	register_sidebar( array(
		'name' => __( 'Primary Widget Area', 'ceyloan' ),
		'id' => 'primary-widget-area',
		'description' => __( 'The primary widget area', 'ceyloan' ),
		'before_widget' => '<div class="widget-area">',
		'after_widget' => '</div>',
		'before_title' => '<h2 class="widget-title">',
		'after_title' => '</h2>',
	) );
}
/** Register sidebars by running ceyloan_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'ceyloan_widgets_init' );

function ceyloan_fallback_menu(){
						echo '<div id="menu"><ul id="nav">';
                                                $categories=get_categories();
                                                $count=0;
                                                foreach($categories as $category){
                                                    echo '<li><a href="'.esc_url( home_url( '/' ) ).'?cat='.$category->cat_ID.'" >'.$category->name.'</a></li>';
                                                    $count++;
                                                    if($count==3){
                                                        break;
                                                    }
                                                }
						echo '</ul></div>';
}

if ( ! function_exists( 'ceyloan_comment' ) ) :
/**
 * Template for comments and pingbacks.
 *
 * To override this walker in a child theme without modifying the comments template
 * simply create your own ceyloan_comment(), and that function will be used instead.
 *
 * Used as a callback by wp_list_comments() for displaying the comments.
 *
 * @since ceyloan 1.0
 */
function ceyloan_comment( $comment, $args, $depth ) {
	$GLOBALS['comment'] = $comment;
	switch ( $comment->comment_type ) :
		case '' :
	?>
	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
		<div id="comment-<?php comment_ID(); ?>">
		<div class="comment-author vcard">
			<?php echo get_avatar( $comment, 40 ); ?>
			<?php printf( __( '%s <span class="says">says:</span>', 'ceyloan' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
		</div><!-- .comment-author .vcard -->
		<?php if ( $comment->comment_approved == '0' ) : ?>
			<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'ceyloan' ); ?></em>
			<br />
		<?php endif; ?>

		<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
			<?php
				/* translators: 1: date, 2: time */
				printf( __( '%1$s at %2$s', 'ceyloan' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'ceyloan' ), ' ' );
			?>
		</div><!-- .comment-meta .commentmetadata -->

		<div class="comment-body"><?php comment_text(); ?></div>

		<div class="reply">
			<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
		</div><!-- .reply -->
	</div><!-- #comment-##  -->

	<?php
			break;
		case 'pingback'  :
		case 'trackback' :
	?>
	<li class="post pingback">
		<p><?php _e( 'Pingback:', 'ceyloan' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'ceyloan' ), ' ' ); ?></p>
	<?php
			break;
	endswitch;
}
endif;
	// Load up our theme options page and related code.
	require( dirname( __FILE__ ) . '/inc/theme-options.php' );
?>